<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>柱状图</title>
    <style>
        #my_chart p {
            display: inline-block;
            background: #4285F4;
            width: 20px;
            margin-right: 3px;
        }
    </style>
</head>

<body>
    <div id="my_chart"></div>
    <script src="https://d3js.org/d3.v3.min.js"></script>
    <script>
        var p = d3.select("#my_chart")
            .selectAll("p")
            .data([4, 8, 15, 16, 23, 42])
            .text(function (d) {
                return d;
            });
    </script>

</body>

</html>